import subprocess
import datetime
import os
from config import EXPORT_PATH

# export_fn = os.path.join(EXPORT_PATH, f'res-{datetime.datetime.now().isoformat()}.mp4')
export_fn = os.path.join(EXPORT_PATH, f'res-{datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")}.mp4')

ffmpeg_res = subprocess.Popen('ffmpeg '
                              '-f rawvideo -pixel_format bgr24 -r 5 -video_size 640x480 -i - '
                              f'-vsync cfr -r 24 "{export_fn}"',
                              stdin=subprocess.PIPE,
                              bufsize=1024 * 1024 * 2)
